import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/tools";

/**
 * @description 查询书籍列表
 * */
export function listBooks(query) {
  return request({
    url: '/library/books',
    method: 'get',
    params: query
  })
}


export function listClass(query) {
  return request({
    url: '/library/categories',
    method: 'get',
    params: query
  })
}


export function getBook(id) {
  return request({
    url: '/library/book/' + id,
    method: 'get'

  })
}

export function updateBook(data) {
  return request({
    url: '/library/book',
    method: 'post',
    data: data
  })
}

export function addBook(data) {
  return request({
    url: '/library/book',
    method: 'put',
    data: data
  })
}

export function delBook(id) {
  return request({
    url: '/library/book/' + id,
    method: 'delete'
  })
}

/**
 * @description 搜索zlibrary书籍列表
 * */
export function getLibBooks(query) {

  return request({
    url: '/library/libbooks',
    method: 'get',
    params: query
  })
}

/**
 * @description 根据isbn所有书籍信息
 * */
export function getBookInfo(query) {

  return request({
    url: '/library/isbn',
    method: 'get',
    params: query
  })
}